﻿Public Class uiManager
    Dim _mainForm As frmMain
    Public Function Getui() As frmMain
        _mainForm = New frmMain
        Return _mainForm
    End Function
    Public Sub CloseUI()
        If _mainForm IsNot Nothing Then
            If _mainForm.InvokeRequired Then
                _mainForm.Invoke(New Action(AddressOf CloseUIInvokeRequired))
            Else
                _mainForm.Close()
                _mainForm = Nothing
            End If
        End If
    End Sub
    Private Sub CloseUIInvokeRequired()
        _mainForm.Close()
        _mainForm = Nothing
    End Sub
End Class
